package cn.com.pc.content.controller;

import cn.com.pc.content.domain.Biz;
import cn.com.pc.content.domain.Site;
import cn.com.pc.content.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 召回类 controller
 */
@RestController
@RequestMapping("/content")
public class ContentController {

    @Autowired
    private ContentService contentService;

    @GetMapping("/object-id")
    public String getObjectId(@RequestAttribute("site") Site site, @RequestAttribute("biz") Biz biz) {
        return contentService.getObjectId(site, biz);
    }

    @GetMapping("/{contentId:\\w+}")
    public Map<String, Object> getContentType(@RequestAttribute("site") Site site, @RequestAttribute(value = "biz", required = false) Biz biz, @PathVariable("contentId") String contentId) {
        return contentService.getObjectContentType(contentId, site);
    }

}
